<script setup lang="ts">
import { ref } from 'vue'

const data = ref([
  {
    id: 1,
    name: '某某某路-某某某路',
    count: 1221,
    percentage: 50,
  },
  {
    id: 2,
    name: '某某某路-某某某路',
    count: 1221,
    percentage: 50,
  },
  {
    id: 3,
    name: '某某某路-某某某路',
    count: 1221,
    percentage: 50,
  },
  {
    id: 4,
    name: '某某某路-某某某路',
    count: 1221,
    percentage: 50,
  },
  {
    id: 5,
    name: '某某某路-某某某路',
    count: 1221,
    percentage: 50,
  },
  {
    id: 6,
    name: '某某某路-某某某路',
    count: 1221,
    percentage: 50,
  },
])
</script>

<template>
  <div>
    <h4>
      <img src="../../../assets/icon_double_arrow.png" />
      <span>热点过车排名</span>
    </h4>
    <ul class="rank-list">
      <li class="item" v-for="(item, index) in data" :key="item.id">
        <div class="info">
          <div class="name">
            <img v-if="index === 0" class="icon-rank" src="../../../assets/icon_rank_1.png" />
            <img v-else-if="index === 1" class="icon-rank" src="../../../assets/icon_rank_2.png" />
            <img v-else-if="index === 2" class="icon-rank" src="../../../assets/icon_rank_3.png" />
            <span style="display: inline-block" v-else class="icon-rank">
              {{ index + 1 }}
            </span>

            <span>{{ item.name }}</span>
          </div>
          <span>{{ item.count }}辆</span>
        </div>
        <el-progress class="progress" :percentage="item.percentage" :show-text="false" color="linear-gradient( 270deg, #71CBED 0%, #19A5E1 100%)" />
      </li>
    </ul>
  </div>
</template>

<style lang="scss" scoped>
h4 {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  font-weight: 600;
  font-size: 16px;
  line-height: 22px;
  color: #c5fbff;
  > img {
    width: 18px;
    width: 19px;
    margin-right: 4px;
  }
}

ul.rank-list {
  li.item {
    list-style: none;

    .info {
      display: flex;
      justify-content: space-between;
      .name {
        display: flex;
        align-items: center;
        margin-bottom: 4px;
        .icon-rank {
          margin-right: 8px;
          width: 20px;
          height: 24px;
        }
      }
    }

    .progress {
      :deep(.el-progress-bar__outer) {
        background-color: #334453;
      }
    }
  }
  .item + .item {
    margin-top: 10px;
  }
}
</style>
